﻿@model ExcellOnServices.Models.Product
@{
    ExcellOnServices.Models.ExcellOnServicesContext db = new ExcellOnServices.Models.ExcellOnServicesContext();
    IEnumerable<SelectListItem> categoryList = new SelectList(db.Categories, "Id", "Name", null);
}

@using (Html.BeginForm("Create", "Products", new { isDirectCreate = true }, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <div class="panel-body">
        @Html.AntiForgeryToken()
        <div class="form-horizontal">
            <div class="form-group">
                @Html.LabelFor(model => model.Name, "Name", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Name)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Price, "Price ($)", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Price, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Price)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Discount, "Discount ($)", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.Discount, new { @class = "form-control", @Value = "0" })
                    @Html.ValidationMessageFor(model => model.Discount)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Description, new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextAreaFor(model => model.Description, new { @class = "form-control mceEditor", @style = "resize:vertical;", @rows = "8" })
                    @Html.ValidationMessageFor(model => model.Description)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.ImageUrl, "Image", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.TextBoxFor(model => model.ImageUrl, new { @type = "file" })
                    @Html.ValidationMessageFor(model => model.ImageUrl)
                </div>
            </div>

            <div class="form-group">
                @Html.LabelFor(model => model.Category_Id, "Category", new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                    @Html.DropDownList("Category_Id", categoryList, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Category_Id)
                </div>
            </div>
        </div>
    </div>
    @Html.ValidationSummary(true)
    <div class="modal-footer">
        <input type="submit" value="Create" class="btn btn-primary" />
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
}
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
